<template>
    <div>
        <Header titleText="窗口退费" />
        <el-divider></el-divider>
        <h3>患者信息查询</h3>
        <div class="ly-filter">
            <el-input placeholder="请输入病历号" v-model="query.caseNumber" @keydown="search"></el-input>
        </div>
        <el-divider />
        <h3>患者信息确认</h3>
        <el-form style="margin: 20px 0" inline label-width="80px">
            <el-form-item label="患者姓名">{{ result.register.realName }}</el-form-item>
            <el-form-item label="身份证号">{{ result.register.cardNumber }}</el-form-item>
            <el-form-item label="年龄">{{ result.register.age }}</el-form-item>
            <el-form-item label="性别">{{ result.register.gender }}</el-form-item>
        </el-form>
        <DrugTable style="margin-top: 20px" :tableData="result.tableData" :refresh-drugs="refreshDrugs" />
    </div>
</template>

<script setup>
import Header from '@/components/doctor/header';
import { reactive, ref } from 'vue';
import DrugTable from './drugTable.vue';
import { get } from '@/utils/axios'

const query = reactive({
    caseNumber: '',
    checkState: '已缴费'
})
const result = reactive({
    register: {},
    tableData: []
})
function search(event) {
    if (event.keyCode === 13) {
        getTableData()
    }
}
function getTableData() {
    get('/prescription/selectPayList', query, content => {
        console.dir(content)
        result.register = content.register
        result.tableData = content.prescriptionList
    })
    // get('/prescription/jiaofei', query, content => {
    //     drugTable.value = content
    //     console.dir(content)
    // })
}
function refreshDrugs() {
  // 这里可以执行一些额外的操作，比如重新获取数据
  getTableData();
}

</script>

<style lang="scss" scoped>
.ly-filter {
    margin-top: 20px;
}
</style>